﻿using Microsoft.EntityFrameworkCore;
using PCH.Entities;

namespace PCH
{
    public class EFDbContext:DbContext // 继承 EF DbContext类
    {
        public EFDbContext(DbContextOptions<EFDbContext> options) : base(options)
        { 
        
        }

        public virtual DbSet<Register> Registers { get; set; }

        public virtual DbSet<ExamResult> ExamResults { get; set; }

        public virtual DbSet<AuditDaily> AuditDailies { get; set; }

        public virtual DbSet<BeSpoke> BeSpokes { get; set; }

        public virtual DbSet<Basc> Bascs { get; set; }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
            modelBuilder.Entity<Register>().ToView("V_BESPOKE");
            modelBuilder.Entity<ExamResult>().ToView("V_PACSResult");
            modelBuilder.Entity<AuditDaily>().ToView("V_Audit_Daily");
        }
    }
}
